package com.example.su_shi_tan_bas_lib.album.view.editor_img.view

import android.graphics.Path
import com.example.su_shi_tan_bas_lib.album.view.editor_img.core.IMGPath

class Pen : IMGPath() {
    private var identity = Int.MIN_VALUE
    fun reset() {
        path.reset()
        identity = Int.MIN_VALUE
    }

    fun reset(x: Float, y: Float) {
        path.reset()
        path.moveTo(x, y)
        identity = Int.MIN_VALUE
    }

    fun setIdentity(identity: Int) {
        this.identity = identity
    }

    fun isIdentity(identity: Int): Boolean {
        return this.identity == identity
    }

    fun lineTo(x: Float, y: Float) {
        path.lineTo(x, y)
    }

    val isEmpty: Boolean
        get() = path.isEmpty

    fun toPath(): IMGPath {
        return IMGPath(Path(path), mode, color, width)
    }
}